<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center suggestion_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub suggestion_fd0_0'>
          <view class='flex flex-wrap align-center suggestion_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  suggestion_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='suggestion_fd0_0_c1_c0'>{{$t('意见反馈')}}</text>
          </view>
          <view class='flex flex-wrap align-center justify-end suggestion_fd0_0_c0'>
            <text class='suggestion_fd0_0_c2_c0' @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/wode/suggestionLst/suggestionLst`">{{$t('反馈记录')}}</text>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout suggestion_flex_1">
        <view class='flex flex-wrap align-center suggestion_fd1_0'>
          <text class='suggestion_fd1_0_c0'>{{$t('反馈类型')}}</text>
        </view>
        <view class='flex flex-direction flex-wrap align-stretch suggestion_fd1_1'>
          <benben-select-diy ref="showSelectPopup1698652656207" class-name='flex flex-wrap align-center flex'
            :items.sync="feedBackList" v-model="feedBack_id" default-type="aid" default-label="title"
            :allow-cancel='false' type="radio" :disabled='false'>
            <template v-for='(item,key0) in feedBackList'>
              <view v-if="item.isSelected" class='flex align-center justify-center flex suggestion_fd1_1_c0_c0'
                :key="key0" @tap="$refs.showSelectPopup1698652656207.tapHandle(key0)">
                <text class='flex-sub suggestion_fd1_1_c0_c0_c0'>{{item.title}}</text>
              </view>
              <view v-else class='flex align-center justify-center flex suggestion_fd1_1_c0_c1' :key="key0"
                @tap="$refs.showSelectPopup1698652656207.tapHandle(key0)">
                <text class='flex-sub suggestion_fd1_1_c0_c1_c0'>{{item.title}}</text>
              </view>
            </template></benben-select-diy>
        </view>
        <text class='suggestion_fd1_2'>{{$t('问题描述')}}</text>
        <view class='flex flex-direction flex-wrap align-stretch suggestion_fd1_3'>
          <view class='flex flex-wrap suggestion_fd1_3_c0'>
            <textarea class='flex suggestion_input_fd1_3_c0' confirm-type="done"
              :placeholder="$t('问题描述的越详细，有助于我们更快的解决问题')" :maxlength="300" :show-num='true'
              placeholder-style="color:#999;font-size:28rpx" v-model="feedback_content" />
            <template>
              <view class='flex flex justify-end suggestion_numberfd1_3_c0_c0'>
                <text>{{feedback_content.length}}</text>
                <text>/</text>
                <text>300</text>
              </view>
            </template>
          </view>
          <view class='flex flex-direction flex-wrap align-stretch'>
            <benben-images-upload ref="benbenImagesUploadfd1_3_c1_c0" :img-list.sync="feedBackImgs"
              :img-ids.sync="imgs_ids" :is-show-tips='true' :maxlength="6">
              <template #content="{ num, maxlength, isShow, imgList }">
                <view class="flex flex-wrap align-start flex suggestion_fd1_3_c1_c0">

                  <view v-for="(image, index) in imgList" :key="index"
                    class='flex position-relative suggestion_fd1_3_c1_c00'>
                    <text class='fu-iconfont2 position-absolute suggestion_fd1_3_c1_c000'
                      @tap.stop="$refs.benbenImagesUploadfd1_3_c1_c0.delImage(index)">&#xE8E7;</text>
                    <image class='suggestion_fd1_3_c1_c001'
                      @tap.stop="$refs.benbenImagesUploadfd1_3_c1_c0.previewImage(index)" mode="aspectFill"
                      :src='image'></image>
                  </view>

                  <image class='suggestion_fd1_3_c1_c01'
                    @tap.stop="$refs.benbenImagesUploadfd1_3_c1_c0.manyChooseImage()" v-if="isShow" mode="aspectFit"
                    :src='STATIC_URL+"82.png"'></image>
                  <text class='image_upload_tips suggestion_fd1_3_c1_c02'>{{$t('请上传应用截图，最多上传')}}6{{$t('张')}}</text>
                </view>
              </template>
            </benben-images-upload>
          </view>
        </view>
      </view>


      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-center benben-flex-layout suggestion_flex_2"
        @tap.stop="submitFeedBackFunc()">
        <button class='suggestion_fd2_0' @tap.stop="submitFeedBackFunc()">{{$t('提交反馈')}}</button>
      </view>

      <!---flex布局flex布局结束-->


    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},


    data() {
      return {
        "feedBackList": [],
        "feedBack_id": "",
        "feedback_content": "",
        "imgs_ids": "",
        "contact": "",
        "feedBackImgs": [],
        "name": "name",
        isclick:false
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      this.getFeedBackFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //获取反馈类型列表
      async getFeedBackFunc() {
        //请求方法
        //数据验证

        let datafeedBackList = await this.$api.post(global.apiUrls.post6414719bdc956, {
          user_type: '1'
        });

        if (datafeedBackList.data.code != 1) {
          this.$message.info(datafeedBackList.data.msg);
          return
        }
        let infofeedBackList = datafeedBackList.data;
        this.feedBackList = infofeedBackList.data

      },
      //提交意见反馈
      async submitFeedBackFunc() {
        if (!validate(this.feedBack_id, 'require')) {
          this.$message.info(this.$t('请选择反馈类型'));
          return false;
        }
        if(this.feedBackImgs.length==0){
          this.$message.info(this.$t('请上传图片'));
          return;
        }
        //请求方法
        //数据验证
        if(this.isclick){
          return;
        }
        let data6414724b96f3f = await this.$api.post(global.apiUrls.post6414724b96f3f, {
          type_id: this.feedBack_id,
          body: this.feedback_content,
          thumb: this.imgs_ids,
          contact: this.imgs_ids,
          user_type: '1'
        });
        this.isclick=true
        if (data6414724b96f3f.data.code != 1) {
          this.$message.info(data6414724b96f3f.data.msg);
          return
        }



        setTimeout(() => {
          this.$urouter.navigateBack(1);
        }, 800)
        this.$message.info('提交成功');
      },
      //leixng
      async fankuileixingFunc() {
        //请求方法
        //数据验证

        let datafeedBackList = await this.$api.post(global.apiUrls.post6414719bdc956, {
          user_type: '1'
        });

        if (datafeedBackList.data.code != 1) {
          this.$message.info(datafeedBackList.data.msg);
          return
        }
        let infofeedBackList = datafeedBackList.data;
        this.feedBackList = infofeedBackList.data

      },
      //列表跳转
      lstFunc() {
        this.$urouter.navigateTo(`/pages/wode/suggestionLst/suggestionLst`);
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(255, 255, 255, 1);
    background-size: 100% auto;
  }

  .suggestion_flex_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .suggestion_fd0_0_c2_c0 {
    color: #0181FF;
    font-size: 32rpx;
    font-weight: 400;
    line-height: 42rpx;
  }

  .suggestion_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333;
    line-height: 88rpx;
  }

  .suggestion_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .suggestion_fd0_0_c0 {
    width: 147rpx;
  }

  .suggestion_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .suggestion_flex_1 {
    background: #fff;
    background-size: 100% auto !important;
    position: relative;
  }

  .suggestion_fd1_3_c1_c02 {
    font-size: 24rpx;
    color: rgba(191, 191, 191, 1);
    font-weight: 400;
    width: 100%;
  }

  .suggestion_fd1_3_c1_c01 {
    width: 160rpx;
    height: 160rpx;
    margin: 0rpx 24rpx 24rpx 0rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }

  .suggestion_fd1_3_c1_c001 {
    width: 160rpx;
    height: 160rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }

  .suggestion_fd1_3_c1_c000 {
    top: 0rpx;
    right: 0rpx;
    z-index: 10;
    color: #ff5536;
  }

  .suggestion_fd1_3_c1_c00 {
    margin: 0rpx 24rpx 24rpx 0rpx;
  }

  .suggestion_fd1_3_c1_c0 {
    padding: 24rpx 0rpx 0rpx 24rpx;
  }

  .suggestion_numberfd1_3_c0_c0 {
    width: 100%;
    font-size: 24rpx;
    color: rgba(191, 191, 191, 1);
    line-height: 46rpx;
    font-weight: 400;
  }

  .suggestion_input_fd1_3_c0 {
    width: 100%;
    height: 300rpx;
    font-size: 28rpx;
    font-weight: 400;
    color: #333;
  }

  .suggestion_fd1_3_c0 {
    background: rgba(246, 246, 246, 1);
    width: 686rpx;
    border-radius: 16rpx;
    margin: 0rpx 0rpx 0rpx 32rpx;
    padding: 24rpx;
    background-size: 100% auto;
  }

  .suggestion_fd1_3 {
    margin: 0rpx 0rpx 32rpx 0rpx;
  }

  .suggestion_fd1_2 {
    font-size: 32rpx;
    font-weight: 500;
    color: #1A1A1A;
    line-height: 109rpx;
    margin: 0rpx 32rpx 0rpx 32rpx;
  }

  .suggestion_fd1_1_c0_c1_c0 {
    font-size: 28rpx;
    font-weight: 400;
    color: rgba(153, 153, 153, 1);
    line-height: 28rpx;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    text-align: center;
  }

  .suggestion_fd1_1_c0_c1 {
    background: rgba(246, 247, 249, 1);
    margin: 16rpx 16rpx 16rpx 16rpx;
    height: 64rpx;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    width: 206rpx;
    padding: 0rpx 10rpx 0rpx 10rpx;
  }

  .suggestion_fd1_1_c0_c0_c0 {
    font-size: 28rpx;
    font-weight: 400;
    color: rgba(255, 255, 255, 1);
    line-height: 28rpx;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    text-align: center;
  }

  .suggestion_fd1_1_c0_c0 {
    background: rgba(1, 129, 255, 1);
    margin: 16rpx 16rpx 16rpx 16rpx;
    height: 64rpx;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    width: 206rpx;
    padding: 0rpx 10rpx 0rpx 10rpx;
  }

  .suggestion_fd1_1 {
    border-bottom: 10px solid rgba(246, 247, 248, 1);
    padding: 0rpx 16rpx 16rpx 16rpx;
  }

  .suggestion_fd1_0_c0 {
    font-size: 32rpx;
    font-weight: 500;
    color: #1A1A1A;
    margin: 0rpx 32rpx 0rpx 32rpx;
  }

  .suggestion_fd1_0 {
    padding: 32rpx 0rpx 32rpx 0rpx;
  }

  .suggestion_flex_2 {
    margin: 20rpx 0rpx 20rpx 0rpx;
  }

  .suggestion_fd2_0 {
    background: #4781f5;
    border-radius: 44rpx;
    width: 686rpx;
    line-height: 88rpx;
    font-size: 32rpx;
    color: #fff;
    position: fixed;
    bottom: calc(60rpx + var(--window-bottom));
  }
</style>
